home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
01
/
6
/
DISK0162.ZIP
/
LC.SB
< prev
next >
Wrap
Text File
|
1984-06-25
|
609b
|
26 lines
'A Simple Structured BASIC program to count the lines in an ASCII file.
procedure MAIN
on error goto CHECK.FOR.EOF
input "File Name"; FILE.NAME$
open FILE.NAME$ for input as #1
LINE.COUNT = 0 : DONE.SW = 0
repeat
line input #1, L$
LINE.COUNT = LINE.COUNT+1
until DONE.SW = 1
print "There are";LINE.COUNT-1;"lines in ";FILE.NAME$
endproc
CHECK.FOR.EOF|
ERROR.CODE = ERR : ERROR.LINE = ERL
if ERROR.CODE = 62
DONE.SW = 1
resume next
else
print "BASIC error";ERROR.CODE;"at";ERROR.LINE
stop 'Immediately halt program
endif
end